using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._General
{
    /// <summary>
    /// <para>Find Identical</para>
    /// <para>Reports any records in a feature class or table that have identical values in a list of fields, and generates a table listing these identical records. If the field Shape is selected, feature geometries are compared.</para>
    /// <para>报告要素类或表中字段列表中具有相同值的任何记录，并生成列出这些相同记录的表。如果选择字段形状，则将比较要素几何。</para>
    /// </summary>    
    [DisplayName("Find Identical")]
    public class FindIdentical : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public FindIdentical()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_dataset">
        /// <para>Input Dataset</para>
        /// <para>The table or feature class for which identical records will be found.</para>
        /// <para>将找到相同记录的表或要素类。</para>
        /// </param>
        /// <param name="_out_dataset">
        /// <para>Output Dataset</para>
        /// <para>The output table reporting identical records. The FEAT_SEQ field in the output table will have the same value for identical records.</para>
        /// <para>报告相同记录的输出表。对于相同的记录，输出表中的 FEAT_SEQ 字段将具有相同的值。</para>
        /// </param>
        /// <param name="_fields">
        /// <para>Field(s)</para>
        /// <para>The field or fields whose values will be compared to find identical records.</para>
        /// <para>将比较其值以查找相同记录的一个或多个字段。</para>
        /// </param>
        public FindIdentical(object _in_dataset, object _out_dataset, List<object> _fields)
        {
            this._in_dataset = _in_dataset;
            this._out_dataset = _out_dataset;
            this._fields = _fields;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Find Identical";

        public override string CallName => "management.FindIdentical";

        public override List<string> AcceptEnvironments => ["XYTolerance", "ZTolerance", "extent", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_dataset, _out_dataset, _fields, _xy_tolerance, _z_tolerance, _output_record_option.GetGPValue()];

        /// <summary>
        /// <para>Input Dataset</para>
        /// <para>The table or feature class for which identical records will be found.</para>
        /// <para>将找到相同记录的表或要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Dataset")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_dataset { get; set; }


        /// <summary>
        /// <para>Output Dataset</para>
        /// <para>The output table reporting identical records. The FEAT_SEQ field in the output table will have the same value for identical records.</para>
        /// <para>报告相同记录的输出表。对于相同的记录，输出表中的 FEAT_SEQ 字段将具有相同的值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Dataset")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_dataset { get; set; }


        /// <summary>
        /// <para>Field(s)</para>
        /// <para>The field or fields whose values will be compared to find identical records.</para>
        /// <para>将比较其值以查找相同记录的一个或多个字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field(s)")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _fields { get; set; }


        /// <summary>
        /// <para>XY Tolerance</para>
        /// <para>The xy tolerance that will be applied to each vertex when evaluating if there is an identical vertex in another feature. This parameter is enabled only when Shape is selected as one of the fields.</para>
        /// <para>在评估另一个特征中是否存在相同的折点时将应用于每个折点的 xy 容差。仅当选择“形状”作为其中一个字段时，才会启用此参数。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("XY Tolerance")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string? _xy_tolerance { get; set; } = null;


        /// <summary>
        /// <para>Z Tolerance</para>
        /// <para>The Z tolerance that will be applied to each vertex when evaluating if there is an identical vertex in another feature. This parameter is enabled only when Shape is selected as one of the fields.</para>
        /// <para>在评估另一个要素中是否存在相同的折点时将应用于每个折点的 Z 容差。仅当选择“形状”作为其中一个字段时，才会启用此参数。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Z Tolerance")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _z_tolerance { get; set; } = 0;


        /// <summary>
        /// <para>Output only duplicated records</para>
        /// <para><xdoc>
        ///   <para>Choose if you want only duplicated records in the output table.</para>
        ///   <bulletList>
        ///     <bullet_item>Unchecked—All input records will have corresponding records in the output table. This is the default.</bullet_item><para/>
        ///     <bullet_item>Checked—Only duplicate records will have corresponding records in the output table. The output will be empty if no duplicate is found.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>选择是否只想在输出表中重复记录。</para>
        ///   <bulletList>
        ///     <bullet_item>未选中 - 所有输入记录都将在输出表中具有相应的记录。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>选中 - 只有重复的记录才会在输出表中具有相应的记录。如果未找到重复项，则输出将为空。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output only duplicated records")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _output_record_option_value _output_record_option { get; set; } = _output_record_option_value._false;

        public enum _output_record_option_value
        {
            /// <summary>
            /// <para>ONLY_DUPLICATES</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("ONLY_DUPLICATES")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>ALL</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("ALL")]
            [GPEnumValue("false")]
            _false,

        }

        public FindIdentical SetEnv(object XYTolerance = null, object ZTolerance = null, object extent = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(XYTolerance: XYTolerance, ZTolerance: ZTolerance, extent: extent, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}